package com.rran.study.chat.ops.repository;

import com.google.common.collect.Maps;
import com.rran.study.chat.ops.service.accept.AcceptStrategy;

import java.util.Map;

/**
 * @author yy
 * @Type SendHandlerResponsitory.java
 * @Desc
 * @date 2020/8/7 11:03
 */
public class SendHandlerResponsitory {

    private static Map<String, AcceptStrategy> sendHandlerMap = Maps.newConcurrentMap();

    public static AcceptStrategy getSendHandler(String messageType) {
        return sendHandlerMap.get(messageType);
    }

    public static void storeSendHandler(String messageType, AcceptStrategy sendHandler) {
        if (!sendHandlerMap.containsKey(messageType)) {
            sendHandlerMap.put(messageType, sendHandler);
        }
    }
}
